package IO;

import java.io.*;

public class IODemo8 {
    public static void main(String[] args) {
        //本次异常，采用try-catch的方式
        try(InputStream inputStream = new FileInputStream("./test.txt")){
            //
            while(true){
                byte[] buffer = new byte[1024];
                int n = inputStream.read(buffer);
                if(n == -1){
                    System.out.println("已经读完了！！！");
                    break;
                }
                for(int i=0;i<n;i++){
                    System.out.println("读到的这个字符是:"+buffer[i]);
                }
            }
        }  catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
